package com.aaa.stock.service.Impl;


import com.aaa.entity.DictData;
import com.aaa.entity.Provider;
import com.aaa.stock.dao.DictDataDao;
import com.aaa.stock.dao.ProviderDao;
import com.aaa.stock.service.DictDataService;
import com.aaa.vo.Result;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DictDataServiceImpl implements DictDataService {
    @Autowired
    private DictDataDao dictDataDao;

    @Autowired
    private ProviderDao providerDao;
    @Override
    public Result<List<DictData>> findByType(String type) {
        QueryWrapper<DictData> wrapper=new QueryWrapper<>();
        wrapper.eq("dict_type",type);
        List<DictData> list = dictDataDao.selectList(wrapper);
        return new Result<List<DictData>>(200,"查询成功",list);
    }

    @Override
    public Result<List<Provider>> findById(String provideId) {
        QueryWrapper<Provider> wrapper=new QueryWrapper<>();
        wrapper.eq("Provider",provideId);
        List<Provider> list = providerDao.selectList(wrapper);
        return new Result<List<Provider>>(200,"查询成功",list);
    }

//    @Override
//    public Result<List<DictData>> findByMed(String type) {
//        QueryWrapper<DictData> wrapper=new QueryWrapper<>();
//        wrapper.eq("dict_type",type);
//        List<DictData> list = dictDataDao.selectList(wrapper);
//        return new Result<List<DictData>>(200,"查询成功",list);
//
//    }


}
